var beiMiCommon = require("BeiMiCommon");
cc.Class({
    extends: beiMiCommon,

    properties: {
        playerInfo: {
            default: null,
            type: cc.Prefab
        }
    },
    onPlayerInfoClick: function (e) {
        cc.beimi.openwin = cc.instantiate(this.playerInfo);
        cc.beimi.openwin.parent = this.root();
        console.log(e)
        var parent = e.target.parent;
        var username = parent.getChildByName('user').getChildByName('username').getComponent(cc.Label).string;
        var id = parent.getChildByName('user').getChildByName('newId').getComponent(cc.Label).string;
        var ip = parent.getChildByName('user').getChildByName('newIp').getComponent(cc.Label).string;
        var logo = parent.getChildByName('mask').getChildByName('logo').getComponent(cc.Sprite).spriteFrame;
        var v2 = parent.getChildByName('image').getPosition();
        var user = {
            name: username,
            id: id,
            ip: ip,
            logo: logo,
            v2: v2,
            type: 'shuangkou'
        }
        console.log(user)
        cc.beimi.openuser = user
    },
    onPlayerClick: function (e) {
        var parent = e.target.parent.parent;
        var v2 = parent.getPosition();

        if (v2.y > 0) {
            cc.beimi.openwin = cc.instantiate(this.playerInfo);
            cc.beimi.openwin.parent = this.root();

            var username = parent.getChildByName('info').getChildByName('username').getComponent(cc.Label).string;

            var user = {
                name: username,
                v2: v2,
                type: 'majiang'
            }
            cc.beimi.openuser = user
            console.log(v2);
        }
    }
});
